package com.thread;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;


public class JMX {
	public static void main(String[] args) {
		ThreadMXBean mxBean = ManagementFactory.getThreadMXBean();
		long[] ids = mxBean.getAllThreadIds();
		ThreadInfo[] infos = mxBean.getThreadInfo(ids);
		for (int i = 0; i < infos.length; i++) {
			System.out.println("id:"+infos[i].getThreadId()+",name:"+infos[i].getThreadName()+",state:"+infos[i].getThreadState());
		}
	}
}
